|
|
|
|
|
|
|
can use the graphics API to draw your own lines across the columns. The example in Listing 19.1 uses a few API calls to do just that. |
|
|
|
|
|
|
|
|
Listing 19.1 DRAWAPI.ZIPUsing the Graphics API to Enhance a ListView Control |
|
|
|
|
|
|
|
|
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) _
As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long, _
lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
'This code adds 100 items to a listview control
Dim objTemp As ListItem
Dim i As Integer
Me.ScaleMode = 3
With Me.ListView1
.View = lvwReport
.ColumnHeaders.Add , , "Column1"
.ColumnHeaders.Add , , "Column2"
For i = 1 To 100
Set objTemp = .ListItems.Add(, , "Item " & i)
objTemp.SubItems(1) = "Top " & objTemp.Top
.Refresh
Next i
End With
End Sub
Private Sub ListView1_ItemClick(ByVal Item As ComctlLib.ListItem)
Dim hdc As Long
Dim pointx As POINTAPI
Dim lRetVal As Long
Dim nHeight As Integer
Dim lTemp As Long
'The form's ScaleMode property MUST be
'set to pixels for this to work properly.
nHeight = Me.TextHeight("X")
With ListView1
.Refresh
hdc = GetDC(.hwnd) |
|
|
|
|
|